﻿@using Lari.Configuration
@model List<Lari.Services.ViewModel.StateModel>
@{
    var grid = new WebGrid( Model, rowsPerPage: ApplicationConfig.RowPerPage,
    canPage: true, canSort: true, defaultSort: "Code");
    grid.Pager(WebGridPagerModes.Numeric);
   
} 
@functions
{
    MvcHtmlString FormatImage(bool isDefault)
    {
        return MvcHtmlString.Create(string.Format("<Img src=\"{0}\"/>", isDefault ? Url.Content("~/Content/Images/tick_button.png") : Url.Content("~/Content/Images/cross_button.png")));
    }

}
<div id="pagetitle">
    <h1>@ScreenName.Masters.ListStates</h1>
</div>
<div class="spacer">
</div>
<div id="pagecontent">
    <div class="spacer">
    </div>
    <div id="grid" style="width: 50%">
        @grid.GetHtml(
                        tableStyle: "webgrid",
                        headerStyle: "webgrid-header",
                        footerStyle: "webgrid-footer",
                        alternatingRowStyle: "webgrid-alternating-row",
                        selectedRowStyle: "webgrid-selected-row",
                        rowStyle: "webgrid-row-style",
                        columns: grid.Columns(grid.Column("Code", "Code"), grid.Column("Name", "Name"), 
                        grid.Column("Default",format: item => @FormatImage(item.IsDefault)),
                        grid.Column(format: item => Html.ActionLink(GuiActionName.Modify, ActionConst.Masters.Common.ModifyState, new { id = item.Code }))
                        )


                        )
    </div>
    <div class="doubleSpacer">
    </div>
    <div>
        @Html.ActionLink(ScreenName.Masters.NewState, ActionConst.Masters.Common.CreateState)
    </div>
    <div class="spacer">
    </div>
</div>

